package com.ohc.其它.网络编程;

import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;

public class TcpClientDemo01 {
    public static void main(String[] args) throws Exception {
        Socket socket = null;
        OutputStream os = null;
        try {
            InetAddress serverIP = InetAddress.getByName("127.0.0.1");
            int port = 9999;
            socket = new Socket(serverIP, port);
            os = socket.getOutputStream();
            os.write("asdfdasfdsa".getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            os.close();
            socket.close();


        }


    }

}
